package com.woniuxy.hrp.mapper;

import com.woniuxy.hrp.entity.*;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PayMapper {
    @Select("select * from hrp_doctor_patient_medicine where id = #{id}")
    @Results({
            @Result(column = "id", property = "id", id = true),
            @Result(column = "mrecord_id", property = "mrecord.id"),
            @Result(column = "doctor_id", property = "doctor.id"),
            @Result(column = "patient_id", property = "patient.id"),
            @Result(column = "medicine_id", property = "medicine.id"),
            @Result(column = "medicine_id",property = "medicine",one = @One(select = "com.woniuxy.hrp.mapper.MedicineMapper.getById")),
    })
    DoctorPatientMedicine getById(int id);
    @Update("update hrp_doctor_patient_medicine set status = 'y' where id = #{id}")
    void updateDPMstatusbyId(int id);

    @Update("update hrp_doctor_patient_item set status = 'y' where id = #{id}")
    void updateDPIstatusbyId(int id);

    @Select("select * from hrp_doctor_patient_item where id = #{id}")
    @Results({
            @Result(column = "id", property = "id", id = true),
            @Result(column = "mitem_id",property = "mitem",one = @One(select = "com.woniuxy.hrp.mapper.MitemMapper.getById")),
    })
    DoctorAndPatientAndItem getDPIById(int id);
    @Select("select * from hrp_reservation where doctor_time_id IS NULL and patient_id = #{id} and status = 'n'")
    List<Reservation> getNatBypid(int id);
    @Select("select hn.* from hrp_nat hn,hrp_reservation hr where hr.id = #{id} and hr.nat_id=hn.id")
    Nat getByrid(int id);
    @Select("select * from hrp_reservation where id = #{id}")
    Reservation getreservationbyid(int id);
}
